#!/usr/bin/env python
# -*- coding:utf-8 -*-  
#====#====#====#====   
#Author:
#CreatDate:
#Version: 
#====#====#====#====
import unittest
from utils.logger import logger
# import 截图
from utils.save_screen_shot import screen_shot

class BaseUnitest(unittest.TestCase):
    driver = None

    close_browser_current_tab_on_tear_down = False


    def assertEqual_new(self, first, second,driver, msg=None):

           if self.assertEqual(first,second,msg) is True:
                logger.info('断言成功')
           else:
               logger.error('断言失败')


    def asserIn_new(self, first, second, msg, driver):
        if self.assertIn(first,second,msg) is True:

            logger.info('断言成功')
        else:
            logger.error('断言失败')


    def assertIs_new(self, first, second, msg, driver):
        if self.assertIs(first,second,msg):

            logger.info('断言成功')
        else:
            logger.error('断言失败')

    def assertisNone_new(self,exp,msg,driver):
        if self.assertIsNone(exp,msg):

            logger.info('断言成功')
        else:
            logger.error('断言失败')

    def setUp(self) -> None:
        logger.info("-----开始执行测试用例-----")


    def tearDown(self):
        """
        每个测试结束时执行的动作.

        :return:
        """
        logger.info("-----测试用例已执行完成-----")

        screen_shot(self.driver, n=1)

        if self.close_browser_current_tab_on_tear_down is True:
            self.driver.close()
    @classmethod
    def tearDownClass(cls):
        """
        测试全部结束时执行的动作.

        :return:
        """
        cls.driver.quit()


if __name__ == '__main__':
    unittest.main()




